﻿using System;
using System.Text.RegularExpressions;


namespace BankApplication.UI
{
	public class ValidationHelper
	{
		public static bool IsValidEmail(string strToCheck)
		{
			string patternStrict = @"^(([^<>()[\]\\.,;:\s@\""]+"

				  + @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@"

				  + @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"

				  + @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+"

				  + @"[a-zA-Z]{2,}))$";

			Regex reStrict = new Regex(patternStrict);

			return reStrict.IsMatch(strToCheck);
		}


		public static bool IsValidAlphaNumeric(string strToCheck)
		{
			Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");

			return !objAlphaNumericPattern.IsMatch(strToCheck);
		}


		public static bool IsAlphabetical(string strToCheck)
		{
			Regex objAlphaPattern = new Regex("[^a-zA-Z]");

			return !objAlphaPattern.IsMatch(strToCheck);
		}

		
		public static bool IsNumberical(string strToCheck)
		{
			Regex objNumericalPattern = new Regex("[^0-9]");

			return !objNumericalPattern.IsMatch(strToCheck);
		}


		public static bool IsValidPhoneNumber(string strToecheck)
		{
			Regex phonePattern = new Regex("^\\+?[0-9]+$");

			return phonePattern.IsMatch(strToecheck);
		}

	}
}
